package school30;

import school30.ui.*;
/**
* This is the base class for all aplications.
*/

public abstract class School30App {
	/**
    *State of your application:
    * (enum): BACKGROUND, FOREGROUND, DESTROYED
    */
    private State state;

	/**
	* Start application.
	* Main mathod for application.
	* Writen by application author
	*/
	public abstract void startApp();

	/**
	* Terminate application.
	* Sending by OS to say application, that it is going to die.
	* Writen by application author
	*/
	public abstract void terminateApp ();
	
	/**
	*Process keyboard pressing for current application.
	*/
	public abstract void keyPressed(int keycode);
	public abstract void keyReleased(int keycode);

	/**
	*Command from OS: minimize window.
	*/
	final void minimizeWindow () {
		//too early to write it
	}
	/**
	*Command from OS: maximize window.
	*/
	final void maximizeWindow () {
		//too early to write it
	}

	/**
	*Return this application window width 
	*/
	public final int getWidth () {
		return -1;
	}

	/**
	*Gets height of window.
	*/
	public final int getHeight () {
		return -1;
	}

	/**
	*Move window's left top corner to (x; y). Now do nothing.
	*/
	final void moveTo (int x, int y) {
		//to early to do it
	}
	
	/**
	*Gets horizontal coordinate of left top corner of window. Now do nothing. Return value is always non-negative int
	*/
	final int getX () {
		//too early...
		return -1;
	}

	/**
	*Gets vertical coordinate of left top corner of window. Now do nothing. Return value is always non-negative int
	*/
	final int getY () {
		//too early...
		return -1;
	}
	
	/**
	*Gets the matrix. To this matrix you can write Color
	*/
	public final Color[][] getSprite() {
		return (Color[][])null;
	}

	/**
	*Gets Painter class for this application
	*/
	public Painter getPainter() {
		return new Painter (getSprite());
	}
	/**
	*Refresh screen. Now do nothing.
	*/
	public final void refresh() {
	}
	
	/**
	 *Gets the state of application
	*/
	public final State getState () {
		return state;
	}

	/**
	 *Sets the state of application. If it is going to be DESTROYED, call destroyApp().
	*/
	final void setState (State __state) {
		state = __state;
		if (state == State.DESTROYED)
			terminateApp();
	}
}

